package com.sphd.restaurantsystem.model;


import com.android.volley.VolleyError;
import com.sphd.restaurantsystem.interfaces.VolleyJsonObjectCallBack;
import com.sphd.restaurantsystem.presenter.AddCzInfoPresenterImpl;

import org.json.JSONException;
import org.json.JSONObject;

/**
* Created by Hu on 2016/12/20
*/

public class AddCzInfoModelImpl implements AddCzInfoModel {

    @Override
    public void sendUrl(String url, AddCzInfoPresenterImpl addCzInfoPresenter) {
            volleyUtil.setJsonObjectRequest(url, new VolleyJsonObjectCallBack() {
                @Override
                public void onResponse(JSONObject response) {
                    try {
                        int res=response.getInt("res");
                        addCzInfoPresenter.recRes(res);
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                }

                @Override
                public void onErrorResponse(VolleyError error) {
                    addCzInfoPresenter.sendError(error);
                }
            });
    }
}